package com.pap.product.publish.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.pap.base.controller.BaseController;
import com.pap.obj.vo.response.ResponseVO;
import com.pap.product.agent.publish.IProductPublishDetailAreaAgent;
import com.pap.product.publish.auto.entity.ProductPublishDetailArea;

@RestController
@RequestMapping("/v1/product/publishdetailarea")
public class ProductPublishDetailAreaController extends BaseController<ProductPublishDetailArea, IProductPublishDetailAreaAgent> {

	private static Logger logger  =  LoggerFactory.getLogger(ProductPublishDetailAreaController.class);
	
	@Resource(name = "productPublishDetailAreaAgent")
	@Override
	public void setService(IProductPublishDetailAreaAgent agent) {
		super.service = agent;
	}
	
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/selectbyproductid/{productId}")
	public ResponseVO<ProductPublishDetailArea> selectByProductId(@RequestHeader(value = "clientLicenseId", defaultValue = "-1") String clientLicenseId,
			@RequestHeader(value = "loginUserId", defaultValue = "-1") String loginUserId,
			@PathVariable String productId) throws Exception {

		Map<Object, Object> searchMap = new HashMap<Object, Object>();
		searchMap.put("productId", productId);
		List<ProductPublishDetailArea> list = service.selectListByMap(searchMap);
		return ResponseVO.successdatas(list, null);
	}
}
